import { legacy_createStore as createStore, combineReducers } from 'redux'
import { CollapsedReducer } from './reducer/CollapsedReducer'
import { isLoadingReceduer } from './reducer/IsLoading'

import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'

const reducer = combineReducers({
  CollapsedReducer,
  isLoadingReceduer
})

const persistConfig = {
  key: 'collapsed',
  storage,
  blacklist: ['isLoadingReceduer']
}

const persistedReducer = persistReducer(persistConfig, reducer)


const store = createStore(persistedReducer)
const persistor = persistStore(store)

export { store, persistor }
